<?php

namespace maoxuner\LaravelJsonRpc\Rules;

use Closure;
use Illuminate\Contracts\Validation\ValidationRule;

class Identifier implements ValidationRule
{
    public function validate(string $attribute, mixed $value, Closure $fail): void
    {
        if (! (is_int($value) || is_string($value) || is_null($value))) {
            $fail('The :attribute must be a string or integer.');
        }
    }
}
